const {merge} = require("webpack-merge");
const common = require("./webpack.common.js");
const Dotenv = require('dotenv-webpack');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const path = require("path");
module.exports = merge(common, {
    mode: "production",
    plugins: [
        new Dotenv({
            path: path.join(__dirname, '/env/.env.production')//加载环境变量
        }),
        new MiniCssExtractPlugin({
            filename: 'static/css/styles.css',//单独提出来的引用的css文件路径
        })
    ],
    module: {
        rules: [
            {
                test: /\.(sa|sc|c)ss$/,
                use: [
                    MiniCssExtractPlugin.loader,//单独将css提取到一个文件夹
                    'css-loader',//将cc转换为common模块
                    'sass-loader'//将scss转换为css
                ]
            }
        ]
    }
})
